<?php

// 商品分类表

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->increments('id');

            $table->integer('merchant_id')->default(0)->comment('[v1.0]该分类属于哪个店铺。');
            $table->string('title')->comment('[v1.0]分类名称');
            $table->string('keywords')->nullable()->comment('[v1.0]分类的关键字,可用来搜索。');
            $table->string('desc')->nullable()->comment('[v1.0]分类描述');
            $table->integer('parent_id')->default(0)->index('categories_parent')->comment('[v1.0]该分类的父类ID，取值于该表的id字段。');
            $table->integer('order')->default(0)->comment('[v1.0]该分类在页面显示的顺序，数字越大顺序越靠后。');
            $table->string('style')->nullable()->comment('[v1.0]该分类的单独的样式表');
            $table->boolean('display')->default(true)->comment('[v1.0]是否在前台页面显示');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categories');
    }
}


